
angular.module("crawlerApp").controller("simpleConfigCtrl",function($scope,$http){
    getConfigList("all");
    $scope.type = "all";
    $scope.getConfigList = function(type){
        $scope.type = type;
        getConfigList(type)
    };
    function getConfigList(type) {
        $http.get("crawler/config/getByType/"+type).then(function(response){
            $scope.configList = response.data;
        });
    }
    $scope.detailData = function(data){
        $scope.sourceResult = data;
        $scope.updateData = angular.copy(data);
    };
    $scope.confirm = function(){
        // todo 修改之后的结果
        $http.put("crawler/config/saveOrUpdate",$scope.updateData).then(function(response){
            $scope.sourceResult = response.data;
            getConfigList($scope.type)
        })
    }
});